<?php
 
defined("_VALID_ACCESS") || die('Direct access forbidden'); // - security feature
 
class SCTV_Options extends Module { // - notice how the class name represents its path
 
  public function body() {		
  		$form = & $this->init_module('Libs/QuickForm');
		$form->reset();
		$year = date('y');
		
  		if (isset($_REQUEST['submited']))
		{
			$submited = $_REQUEST['submited'];
			if($submited == 1)
			{
				
				Variable::set('contract_number_'.$year, $_REQUEST['contract_number']);
				Variable::set('bundle_number_'.$year, $_REQUEST['bundle_number']);
			}
		}			
	
		$form->addElement('header', null, __('Next Contract Code'));	
		$form->addElement('text', 'contract_number', __('Current Contract Number'), array('id'=>'contract_number', 'value'=>SCTV_OptionsCommon::get_contract_number($year))); 
		$form->addRule('contract_number', 'error_message', 'required');
		
		$form->addElement('text', 'bundle_number', __('Current Bundle Number'), array('id'=>'bundle_number', 'value'=>SCTV_OptionsCommon::get_bundle_number($year))); 
		$form->addRule('bundle_number', 'error_message', 'required');
					
		$submit = HTML_QuickForm::createElement('submit','submit_button',__('Save'));
		$form->addGroup(array($submit));
		
		
		$form->display();
    }
}
 
?>